home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / util / moni / Sysmon120a.lha / sysmon / contrib / LastGuruLog.rexx
OS/2 REXX Batch file  |  2002-01-06  |  2KB  |  67 lines

  1. /* Last Guru Log ** By Christopher 'WatchDog' Elliott
  2. $VER LastGuruLog.rexx 1.0 (23-Oct-01)
  3. Copyright © 2001 by WatchDog
  4.  
  5. Distribution is only allowed withing Etienne Vogt's SysMon package as it
  6. doesn't work with any other package.
  7.  
  8. History:
  9.   1.0 (23-Oct-01)
  10.       o Initial release sent to author of SysMon package for inclusion.
  11.   0.3 o Clean up code, add headers and comments for release.
  12.   0.2 o Add QUIET argument to prevent output to console.
  13.   0.1 o Initial concept. Adds AlertDump output to SysMon log only
  14.          if there is guru data available.
  15.  
  16. */
  17.  
  18. OPTIONS RESULTS
  19.  
  20. /* Parse command line argument if one exists. */
  21. ARG inpt .
  22. Quiet=0
  23. IF inpt ~= "" THEN
  24.     IF (inpt="QUIET")|(inpt="Q") THEN Quiet=1
  25.         ELSE SIGNAL Usage
  26.  
  27. /* Write AlertDump output to file in T: */
  28. ADDRESS COMMAND 'C:AlertDump CLEAR >t:AlertDump.log'
  29.  
  30. /* Verify that GURU data is available. Exit w/o writing to log if there is none. */
  31. CALL Open(AlertTxt,'T:AlertDump.log','R')
  32. Check=ReadLn(AlertTxt)
  33. IF Check='No LastGuru data available' THEN DO
  34.     CALL Close(AlertTxt)
  35.     IF ~Quiet THEN SAY 'No GURU Information to log.'
  36.     EXIT 0
  37. END
  38.  
  39. /* Write GURU data to log. */
  40. CALL Seek(AlertTxt,0,'B')
  41. Line='The Following is the AlertDump output for the previous GURU'
  42. ADDRESS COMMAND 'C:SysLog "'||LINE||'" LEVEL 1 NOWIN'
  43. DO WHILE ~EOF(AlertTxt)
  44.     Line=ReadLn(AlertTxt)
  45.     ADDRESS COMMAND 'C:SysLog "'||LINE||'" LEVEL 1 NOHEAD NOWIN'
  46. END
  47.  
  48. /* Clean up and report sucessful writing. */
  49. CALL Close(AlertTxt)
  50. /*ADDRESS COMMAND 'C:beep'*/
  51. IF ~Quiet THEN SAY "GURU information saved to SysMon's log file!" '07'X
  52. EXIT 0
  53.  
  54. Usage:
  55.     SAY "RX LastGuruLog.rexx [Q=QUIET]"
  56.     SAY " "
  57.     SAY "Records the output of the SysMon support command AlertDump to the"
  58.     SAY " SysMon log file. A copy of the AlertDump output is also stored in"
  59.     SAY " the file T:AlertDump.log."
  60.     SAY " "
  61.     SAY "The QUIET switch prevents output from LastGuruLog.rexx to STDOUT."
  62.     SAY " "
  63.     SAY "Any invalid first argument shows this usage. Any argument after the"
  64.     SAY " first argument is ignored."
  65.     EXIT 0
  66.  
  67.